package admincow.servlet.vaca;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import admincow.dao.VacaDAO;
import admincow.vo.VacaVO;

/**
 * Servlet implementation class for Servlet: UsuarioEditarServlet
 * 
 */
public class VacaEditarServlet extends javax.servlet.http.HttpServlet
		implements javax.servlet.Servlet {
	static final long serialVersionUID = 1L;

	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public VacaEditarServlet() {
		super();
	}

	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request,
	 *      HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		System.out.println("dentro de vaca editar~~~~~~~");
		
		String  x = request.getParameter("RPvaca");
		VacaDAO dao = new VacaDAO();
		VacaVO vo = dao.obtenerPorRPVaca(x); 
		
		
		System.out.println(vo.getNombre());
		
		request.setAttribute("RPvaca", vo);

		RequestDispatcher rd = request
				.getRequestDispatcher("/vacaEditar.jsp");
		rd.forward(request, response);
	}

	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request,
	 *      HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}
}